<template>
    <div style="width: 100%">
        <div id="deawer">
            <v-tableTitle :title="$t('transmit.importTemRuleSetting')" :btnConfig="btnConfig" @save="save"></v-tableTitle>
            <div class="detailBox">
                <v-detail ref="detail"></v-detail>
            </div>
        </div>
    </div>

</template>

<script>
import baseMixin from "@/mixins/BaseMixin";
import skipMixin from "@/mixins/SkipMixin";
import config from "../Config"
import tableTitle from "commons/TableTitle";
import detail from "../details/Detail"


export default {
    name: "",
    mixins: [baseMixin, skipMixin, config],
    data() {
        return {
            newFlag: false,
            routeData: {}
        };
    },
    computed: {
        btnConfig() {
            return [
                {label: this.$t('common.save'), certigier: !this.btnPermNameList.includes('EN02070401')&&!this.btnPermNameList.includes('WM03160401'),  invalid: "save"}
            ]
        }
    },
    created() {
    },
    methods: {
        //保存按钮
        async save() {
            let flag = this.$refs.detail.$children[0].$refs.input.submitForm("from");
            if (!flag) {
                return;
            }
            let data = {};
            let detail = this.$refs.detail.detailData;
            data = {
                ...detail
            }
            try {
                console.log(data)
                let res = await this.$api.post(`/sysExcelImportRule/updateSysExcelImportRule`, data);
                
                    this.$message.success(res.returnMgr);
                
            } catch (e) {
                this.$message.error(e)
            }
        },
    },
    mounted() {
        ;
        if (Object.keys(this.$store.state.skip).length !== 0) {
            let data = this.$store.state.skip;
            this.routeData = data.routeData;
            this.newFlag = data.newFlag;
        } else {

            this.routeData = this.$store.state.routeData;
            this.newFlag = this.$store.state.newFlag;
        }

    },
    watch: {},
    components: {
        "v-tableTitle": tableTitle,
        "v-detail": detail,
    }
}
</script>

<style scoped>

</style>
